/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.yutel.util;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 *
 * @author yuanyajun
 */
public class Preference {
    private String lang;
    private boolean autoLogin;

    public Preference() {
        lang="zh_cn";
        autoLogin=false;
    }

    public boolean isAutoLogin() {
        return autoLogin;
    }

    public void setAutoLogin(boolean autoLogin) {
        this.autoLogin = autoLogin;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }
    public void serialize(DataOutputStream dos) throws IOException
    {
        dos.writeBoolean(autoLogin);
        dos.writeUTF(lang);
    }

    public static Preference deserialize(DataInputStream dis)
            throws IOException
    {
        Preference preference = new Preference();
        preference.setAutoLogin(dis.readBoolean());
        preference.setLang(dis.readUTF());
        return preference;
    }
}
